{extend name="base" /}
<!-- page specific plugin styles -->
{block name="inline-styles"}
{/block}
<!-- PAGE CONTENT BEGINS -->
{block name="content"}
<div class="page js_show">
    <div class="page__bd" style="height: 100%">
        <div class="weui-tab">
            <div class="weui-tab__panel" id="ajaxForm">

				<div class="weui-panel weui-page-home_head">
					<div class="weui-panel__bd">
						<div class="weui-media-box user_haed">
							<a class="weui-media-box__hd" href="{:url('Index/profile')}">
								<img class="weui-media-box__thumb" id="avatar" src="/static/ace/assets/images/avatars/avatar5.png" width="50" height="50">
							</a>
							<div class="weui-media-box__bd">
								<h4 class="weui-media-box__title" id="name"></h4>
								<div class="weui-media-box__info">
									<span class="weui-media-box__info__grade" id="grade"></span>
									<span class="weui-media-box__info__money">虚拟币:<span id="balance">0.00</span>元</span>
								</div>
							</div>
						</div>
					</div>
					<div class="weui-panel__ft">
						<div class="weui-flex weui-nav">
							<a class="weui-flex__item" href="{:url('Index/invite')}">
								<div class="weui-grid__icon">
									<i class="fa fa-user-plus"></i>
								</div>
								<p class="weui-grid__label">邀请代理</p>
							</a>
							<a class="weui-flex__item" href="{:url('Index/assets')}">
								<div class="weui-grid__icon">
									<i class="fa fa-money"></i>
								</div>
								<p class="weui-grid__label">钱包</p>
							</a>
							<a class="weui-flex__item" href="{:url('Index/bankcard')}">
								<div class="weui-grid__icon">
									<i class="fa fa-credit-card-alt"></i>
								</div>
								<p class="weui-grid__label">银行卡</p>
							</a>
							<a class="weui-flex__item" href="{:url('Index/address')}">
								<div class="weui-grid__icon">
									<i class="fa fa-building"></i>
								</div>
								<p class="weui-grid__label">地址管理</p>
							</a>
						</div>
					</div>
				</div>

				<div class="weui-panel">
					<div class="weui-panel__bd" style="background-color: #0A5BB6; color: #fff;font-size: 16px;padding: 10px 0">
						<a class="weui-cell" href="https://mp.weixin.qq.com/s/wjvoJgV_bvSr3vLW1dXUGA">
							<div class="weui-cell__hd"><img src="/static/mobile/image/icon_zz.png" width="30"></div>
							<div class="weui-cell__bd" style="color: #fff">品正正品进货资质</div>
							<div class="weui-cell__ft" style="color: #fff">点击查看</div>
						</a>
					</div>
				</div>


				<div class="weui-panel weui-panel--team">
					<div class="weui-panel__hd">订单管理</div>
					<div class="weui-panel__bd">
						<div class="weui-grids">
							<a href="{:url('Index/achievement')}?type=team" class="weui-grid js_grid">
								<div class="weui-grid__icon">
									<i class="fa fa-pie-chart"></i>
								</div>
								<p class="weui-grid__label">团队业绩</p>
							</a>
							<a href="{:url('Index/achievement')}?type=alone" class="weui-grid js_grid">
								<div class="weui-grid__icon">
									<i class="fa fa-line-chart"></i>
								</div>
								<p class="weui-grid__label">我的业绩</p>
							</a>
							<a href="{:url('Index/achievement_recharge')}" class="weui-grid js_grid">
								<div class="weui-grid__icon">
									<i class="fa fa-dollar"></i>
								</div>
								<p class="weui-grid__label">团队充值金额</p>
							</a>
							<a href="{:url('Index/reward_order')}" class="weui-grid js_grid">
								<div class="weui-grid__icon">
									<i class="fa fa-cny"></i>
								</div>
								<p class="weui-grid__label">奖励管理</p>
							</a>
							<a href="{:url('Index/agent_team')}" class="weui-grid js_grid">
								<div class="weui-grid__icon">
									<i class="fa fa-sitemap"></i>
								</div>
								<p class="weui-grid__label">团队结构</p>
							</a>
							<a href="{:url('Index/order')}" class="weui-grid js_grid">
								<div class="weui-grid__icon">
									<i class="fa fa-list-alt"></i>
								</div>
								<p class="weui-grid__label">我的订单</p>
							</a>
						</div>
					</div>
				</div>
            </div>
            <div class="weui-tabbar">
                <a href="{:url('Index/home')}" class="weui-tabbar__item weui-bar__item_on">
                    <div class="weui-tabbar__icon">
                    	<i class="fa fa-home"></i>
                    </div>
                    <p class="weui-tabbar__label">主页</p>
                </a>
                <a href="{:url('Index/goods')}" class="weui-tabbar__item">
                    <div class="weui-tabbar__icon">
                    	<i class="fa fa-list"></i>
                    </div>
                    <p class="weui-tabbar__label">下单</p>
                </a>
            </div>
        </div>
    </div>
</div>
{/block}
<!-- PAGE CONTENT ENDS -->
<!-- inline scripts related to this page -->
{block name="related-scripts"}
<script type="text/javascript">
	// 查询个人信息
	$.ajax({
        url: '/api/v1/member/index',
        type: 'GET',
        dataType: 'json',
    })
    .done(function(json) {
        console.log("success");
        $("#avatar").attr("src",json.data.avatar);
        initPageHTML("ajaxForm",json.data);
        if(json.data.grade=="品正商"){
        	$("#grade").css("color","#fff");
        }
    })
    .fail(function() {
        console.log("error");
    })
    .always(function() {
        console.log("complete");
    });
    $("#showToast").click(function(event) {
        /* Act on the event */
        var options={
            url:"/api/v1/member/login",
            type:"POST",
            dataType:"json",
            success: function(json){

                if(json.returnCode==1){
                    $.toast("登陆成功");
                }else{
                    $.toptip(json.returnMsg, 'error');
                }
            }
        };
        $("#ajaxForm").ajaxSubmit(options)
    });

/*$(function(){
    pushHistory(); 
    window.addEventListener("popstate", function(e) {  //回调函数中实现需要的功能
	// alert("我监听到了浏览器的返回按钮事件啦");
	WeixinJSBridge.call('closeWindow');
    }, false);
});*/


</script>
{/block}